package cn.zhentao.charge.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.zhentao.charge.mapper.CouponConditionMapper;
import cn.zhentao.charge.domain.CouponCondition;
import cn.zhentao.charge.service.ICouponConditionService;

/**
 * 条件规则Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-15
 */
@Service
public class CouponConditionServiceImpl implements ICouponConditionService 
{
    @Autowired
    private CouponConditionMapper couponConditionMapper;

    /**
     * 查询条件规则
     * 
     * @param id 条件规则主键
     * @return 条件规则
     */
    @Override
    public CouponCondition selectCouponConditionById(Integer id)
    {
        return couponConditionMapper.selectCouponConditionById(id);
    }

    /**
     * 查询条件规则列表
     * 
     * @param couponCondition 条件规则
     * @return 条件规则
     */
    @Override
    public List<CouponCondition> selectCouponConditionList(CouponCondition couponCondition)
    {
        return couponConditionMapper.selectCouponConditionList(couponCondition);
    }

    /**
     * 新增条件规则
     * 
     * @param couponCondition 条件规则
     * @return 结果
     */
    @Override
    public int insertCouponCondition(CouponCondition couponCondition)
    {
        couponCondition.setCreateTime(DateUtils.getNowDate());
        return couponConditionMapper.insertCouponCondition(couponCondition);
    }

    /**
     * 修改条件规则
     * 
     * @param couponCondition 条件规则
     * @return 结果
     */
    @Override
    public int updateCouponCondition(CouponCondition couponCondition)
    {
        return couponConditionMapper.updateCouponCondition(couponCondition);
    }

    /**
     * 批量删除条件规则
     * 
     * @param ids 需要删除的条件规则主键
     * @return 结果
     */
    @Override
    public int deleteCouponConditionByIds(Integer[] ids)
    {
        return couponConditionMapper.deleteCouponConditionByIds(ids);
    }

    /**
     * 删除条件规则信息
     * 
     * @param id 条件规则主键
     * @return 结果
     */
    @Override
    public int deleteCouponConditionById(Integer id)
    {
        return couponConditionMapper.deleteCouponConditionById(id);
    }
}
